package com.baijiaxing.weixin.family.controller;

import com.baijiaxing.weixin.family.client.model.TsDTO;
import com.baijiaxing.weixin.family.client.param.TsParam;
import com.baijiaxing.weixin.family.model.TsDO;
import com.baijiaxing.weixin.family.client.service.TsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Copyright  BeijingDMCC Co. Ltd.
 * All right reserved
 * 创建日期 16/12/18
 *
 * @Title
 * @Description：TsController
 * @author：yinhongke
 * @email：hongke.yin@datamining.cn
 * @mender:
 * @version：1.0
 * @since：
 * @Remark：
 */
@Controller
@RequestMapping("ts")
public class TsController {
    @Autowired
    private TsService tsService;

    @RequestMapping(value = "/insertTs", method = RequestMethod.GET)
    @ResponseBody
    public TsDTO insertTs(HttpServletRequest request,
                         @RequestParam(value = "id",required = false) String id, //消息体签名
                         @RequestParam(value = "name",required = false) String name, //时间戳
                         @RequestParam(value = "sex",required = false)String sex //随机数字串
    ) {
        TsParam ts = new TsParam();
        ts.setId(2);
        ts.setName("sdfsdfs");
        ts.setSex("nan");
        return tsService.insert(ts);
    }
    @RequestMapping(value = "/findById", method = RequestMethod.GET)
    @ResponseBody
    public TsDTO findById(HttpServletRequest request,
                          @RequestParam(value = "id",required = false) String id){
        return tsService.selectById(id);
    }

}
